<template>
  <div>
    <Layout>
      <top />
      <div class="tags">
        <router-link
          class="tag"
          v-for="tag in tags"
          :key="tag.id"
          :to="`/Labels/edit/${tag.id}`"
        >
          <span>{{ tag.name }}</span> <Icon name="right" />
        </router-link>
      </div>
      <div class="crateTag-Wrapper">
        <Button class="createTag" @click="createTag">新建标签</Button>
      </div>
    </Layout>
  </div>
</template>

<script lang="ts">
import Vue from "vue";
import { Component } from "vue-property-decorator";
import Top from "../components/Top.vue";
import Button from "../components/Button.vue";
import { mixins } from "vue-class-component";
import TagHelper from "../mixins/TagHelper";

@Component({
  components: { Top, Button },
})
export default class Labels extends mixins(TagHelper) {
  get tags() {
    return this.$store.state.tagList;
  }
  $store: any;
  beforeCreate() {
    this.$store.commit("fetchTags");
  }
}
</script>

<style lang="scss" scoped>
.tags {
  background: #fafafa;
  font-size: 16px;
  padding-left: 16px;

  > .tag {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #66896b;
    // border: 1px solid #66896b;
  }
}
.crateTag {
  background: #85bb8b;
  color: #fff;
  border-radius: 10px;
  border: none;
  height: 40px;
  padding: 0 16px;
  &-Wrapper {
    text-align: center;
    padding: 16px;
    margin-top: 44-16px;
  }
}
</style>